﻿<!DOCTYPE html>
<html>
<head>
    <title>系统用户</title>
    $css()$js()
</head>
<body>
<div id="pl_user">
    <div class="form autostyle" id="form1">
        <div class="title" style="margin-top: 0">
            <span class="icon icon1"></span>基本&nbsp;&nbsp;
            <span style="font-weight:normal">(<span class="star">*</span>为必填项,其他选填)</span>
        </div>
        <input type="hidden" field="Id" value="0"/>

        <div class="fl">
            <div class="label"><span class="red">*&nbsp;</span>姓名：
            </div>
            <div class="in">
                <input type="text" class="ui-box ui-validate" required="true" length="[2,10]" field="Name"/>
            </div>
        </div>

        <div class="fl">
            <div class="label"><span class="red">*&nbsp;</span>电话：
            </div>
            <div class="in">
                <input type="text" class="ui-box ui-validate" required="true" field="Phone"/>
            </div>
        </div>

        <div class="fl">
            <div class="label"><span class="red">*&nbsp;</span>邮箱：
            </div>
            <div class="in">
                <input type="text" class="ui-box ui-validate" required="true" field="Email"/>
            </div>
        </div>

        <div class="title" style="margin-top: 0"><span class="icon icon1"></span>登陆账号
        </div>
        <div class="fl">
            <div class="label">
                <span class="red">*&nbsp;</span>用户名：
            </div>
            <div class="in">
                <input type="text" class="ui-box ui-validate" required="true" field="UserName"/>
            </div>
        </div>

        <div class="fl">
            <div class="label">
                <span class="red">*&nbsp;</span>密码：
            </div>
            <div class="in">
                <input type="text" class="ui-box ui-validate" required="true" field="Password"/>
            </div>
        </div>

        <div class="fl">
            <div class="label">启用：
            </div>
            <div class="in">
                <input type="radio" class="radio" field="Enabled" name="Enabled" id="enabled1" value="1" checked="checked"/><label for="enabled1">启用</label>
                <input type="radio" class="radio" field="Enabled" name="Enabled" id="enabled2" value="0"/><label for="enabled2">停用</label>
            </div>
        </div>


        <div class="fl">
            <div class="label">&nbsp;</div>
            <div class="in">
                <span class="ui-button w150" id="btn_save">
                    <span class="button-inner">
                        <span class="button-txt">保存</span>
                        <a href="javascript:;"></a>
                    </span>
                </span>
            </div>
        </div>
    </div>
    </div>
<script type="text/javascript">
    
    var entity = ${entity};
    jr.json.bind('form1', entity);

//        var tplTD = document.getElementsByName('field_groupid')[0].parentNode;
//        var selector = _pl.getElementsByTagName('SELECT')[0];
//        tplTD.innerHTML = '';
//        selector.name = 'field_groupid';
//        selector.className = selector.className.replace('hidden', '');
//        tplTD.appendChild(selector);

    window.saveData = function () {
        if (jr.validator.validate()) {
            jr.xhr.jsonPost('?module=user&action=SaveUser', jr.json.toObject(document), function (json) {
                if (json.result) {
                    var dialog = jr.dialog.getDialog();
                    dialog.window._dg.reload();
                    dialog.close();
                } else {
                    showErr(json.message);
                }
            });
        }
    };
        
    jr.$('btn_save').onclick = window.saveData;
</script>
</body>
</html>
